home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / Utilities / Program Utils. / MEdit ƒ / Pascal.mcr < prev    next >
Encoding:
Text File  |  1986-04-03  |  2.9 KB  |  150 lines  |  [TEXT/MEDT]

  1. **************************************************************************
  2. * This macro file is useful for Pascal programming. It allows you to     *
  3. * insert all important program-structures with one key.                  *
  4. * IMPORTANT: TO SPEED UP LOADING REMOVE ALL COMMENTS (lines starting     *
  5. *            with an asterik)                                            *
  6. * written           : 06.02.86 Matthias Aebi                             *
  7. * Last modification : 31.03.86 Matthias Aebi                             *
  8. **************************************************************************
  9.  
  10. * 1
  11. * puts braces around the current selection
  12. "Comment/K" {
  13.     Push;
  14.     Select(L],C]);
  15.     Insert(" }");
  16.     Select(L[,C[);
  17.     Insert("{ ");
  18.     Pop;
  19.     If L. = L: {
  20.         Select(L.,C. | L:,C:+4);
  21.     }
  22.     Else {
  23.         Select(L.,C. | L:,C:+2);
  24.     };
  25. };
  26.  
  27. * 2
  28. * removes comment-braces at start and end of the current selection
  29. "Uncomment/U" {
  30.     Push;
  31.     Select(L],C]-2 | L],C]);
  32.     Clear;
  33.     Select(L[,C[ | L[,C[+2);
  34.     Clear;
  35.     Pop;
  36. };
  37.  
  38. * 3
  39. * insert a line in the menu
  40. "-" {};
  41.  
  42. * 4
  43. * jumps to the next placeholder in a Pascal structure
  44. "Placeholder/-" {
  45.     Find("{.");
  46.     If L: = 0 And C: = 0 {
  47.         Find("{.");
  48.     };
  49.     Push;
  50.     Find(".}");
  51.     Select(L[,C[ | L:,C:)!;
  52.     Drop;
  53. };
  54.  
  55. * 5
  56. * insert a line in the menu
  57. "-" {};
  58.  
  59. * 6
  60. * insert a PROGRAM template
  61. "PROGRAM/P" {
  62.     Push;
  63.     Insert("PROGRAM {.ProgName.};\N");
  64.     Insert("CONST\n\t{.Constants.};\N\N");
  65.     Insert("TYPE\n\t{.Types.};\N\N");
  66.     Insert("VAR\n\t{.Variables.};\N\N");
  67.     Insert("BEGIN\n\t{.Statement.};\NEND.");
  68.  
  69.     Call(13);
  70. };
  71.  
  72. * 7
  73. * insert a PROCEDURE template
  74. "PROCEDURE" {
  75.     Push;
  76.     Insert("PROCEDURE {.ProcName.} ({.Parameters.});\n");
  77.     Insert("CONST\n\t{.Constants.};\n\T\n");
  78.     Insert("TYPE\n\t{.Types.};\n\T\n");
  79.     Insert("VAR\n\t{.Variables.};\n\T\n");
  80.     Insert("BEGIN\n\t{.Statement.};\n\TEND;");
  81.  
  82.     Call(13);
  83. };
  84.  
  85. *8
  86. * insert a BEGIN-END template
  87. "BEGIN/B" {
  88.     Push;
  89.     Insert("BEGIN\n\t{.Statement.};\n\TEND;");
  90.  
  91.     Call(12);
  92.     Call(13);
  93. };
  94.  
  95. * 9
  96. * insert a FOR-TO-DO template
  97. "FOR/L" {
  98.     Push;
  99.     Insert("FOR {.Variable.} := {.Value.} TO {.Value.} DO\n");
  100.     Insert("\t{.Statement.};");
  101.  
  102.     Call(12);
  103.     Call(13);
  104. };
  105.  
  106. * 10
  107. * insert a CASE template
  108. "CASE" {
  109.     Push;
  110.     Insert("CASE {.Value.} OF\n{.Constant.}:\n\t");
  111.     Insert("{.Statement.};\n\T\nOTHERWISE\n\t");
  112.     Insert("{.Statement.};\n\T\nEND;");
  113.  
  114.     Call(12);
  115.     Call(13);
  116. };
  117.  
  118. * 11
  119. * insert an IF-THEN-ELSE template
  120. "IF/I" {
  121.     Push;
  122.     Insert("IF {.Condition.}\nTHEN\n\t{.Statement.}\n\T");
  123.     Insert("ELSE\n\t{.Statement.};");
  124.  
  125.     Call(12);
  126.     Call(13);
  127. };
  128.  
  129. * 12
  130. * change ;; to ; if any
  131. {
  132.     Push;
  133.     Select(L.,C.-1);
  134.     Find(";;");
  135.     If L. = L[ {
  136.         Insert(";");
  137.     };
  138.     Pop;
  139. };
  140.  
  141. * 13
  142. * select first placeholder
  143. {
  144.     Pop;
  145.     Find("{.");
  146.     Push;
  147.     Find(".}");
  148.     Select(L[,C[ | L:,C:)!;
  149.     Drop;
  150. }.